﻿using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Threading;
using System.Windows.Forms;
using System.Text.RegularExpressions;
using QD.Snapshot.Core.Util;
using QD.Snapshot.Core.BLL.File;

namespace QD.Snapshot.File
{
    public class Work
    {
        public static Thread Begin(TextBox textBox)
        {
            EchoHelper.ShowMessage(textBox, "准备生成截图文件");
            EchoHelper.ShowMessage(textBox, "页码：" + Core.Config.SiteConfig.Page.ToString());
            Thread thread = new Thread(new ThreadStart(delegate()
            {
                while (true)
                {
                    Snap.MackHTML(textBox);

                    if (Snap.IsEmpty)
                        Thread.Sleep(10000);    //休眠10秒
                    else
                        Thread.Sleep(1000);     //休眠1秒
                }
            }));

            thread.IsBackground = true;
            thread.Start();
            return thread;
        }
    }
}